package com.qfedu.util;


/**
 * projectName: logistics
 * author: CGY
 * time: 2020/10/6 11:14
 * description:Json约束类
 */
public class Result {
    //成功为1 失败为0
    private  String code;
    private  String msg;
    private  Object data;

    public static Result success(Object data){
        return new Result(Constants.SUCCESS,data);
    }
    public static Result error(String msg){
        return new Result(Constants.ERROR,msg);
    }

    public Result(){

    }

    public Result(String code,Object data){
        this.code = code;
        this.data = data;
    }
    public Result(String code,String msg){
        this.code = code;
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "Result{" +
                "code='" + code + '\'' +
                ", msg='" + msg + '\'' +
                ", data=" + data +
                '}';
    }
}
